﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using CodeCamp12.BLL;
using System.IO;

namespace CodeCamp12
{
    /// <summary>
    /// Summary description for GetTopLogo
    /// </summary>
    public class GetTopLogo : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            var additionalBuissProvider  = new AdditionalBL();
            try
            {
                var dataStream = additionalBuissProvider.GetLogo();
                var data = new byte[dataStream.Length];
                dataStream.Read(data, 0, (int)dataStream.Length);
                dataStream.Dispose();
                context.Response.Clear();
                context.Response.BinaryWrite(data);
            }
            catch (Exception)
            {
                throw;
            }
            
            
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}